package BaseClasses;

import java.io.Serializable;
import java.util.Date;

import BaseClasses.User;

public class User implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -4110202296782003961L;
	//**Variables**//
	
	private String userID;
	//**User name**//
	private String username;
	//**User Password**//
	private String password;
	//**User first name**//
	private String firstName;
	//**User last name**//
	private String lastName;
	//**User type**//
	private int role; 
	//** privilege **//
	public static final int ADMIN = 0, PRINCIPAL = 1, TEACHER = 2, STUDENT = 3 , INIT=4;
	
	//** constructors **//
	
	/**
	 * constructor
	 * @param Id : ID
	 * @param cs : password
	 */
	public User(String usrName, char[] cs , String ID)
	{
		this.userID = ID;
		this.username = usrName;
		password = new String(cs);
		this.role = INIT;
	}
		
	/**
	 * empty constructor
	 */
	public User()
	{
		this.username = new String();
		this.firstName = new String();
		this.lastName = new String();
		this.password = new String();
		this.role = INIT;
	}
	/**
	 * constructor
	 * @param uid : ID
	 * @param nameP : first name
	 * @param nameL : last name
	 * @param addr : address 
	 * @param dob : Date of birth
	 * @param pass : password
	 * @param utype : user type
	 */
	public User(String uid,String nameP, String nameL,String pass,int utype)
	{
		setUsrName(nameP);
		setUsrId(uid);
		setUsrName(nameL);
		setPassword(pass);
		setRole(utype);
	}
	
	/**
	 * constructor 
	 * @param usr object(full in all parameter of this class)
	 */
	public User(User usr)
	{
		setUsrId(usr.getUserID());
		setFirstName(usr.getFirstName());
		setLastName(usr.getlastName());
		setPassword(usr.getPassword());
		setRole(usr.getRole());
	}
	
	//**Getters & Setters**//

	public User(String text, char[] password2)
	{
		userID = text;
		password = new String(password2);	
	}

	public String getUserID() {
		return userID;
	}
	public String getUserName() {
		return username;
	}		
	public String getFirstName() {
		return firstName;
	}
	public String getlastName() {
		return lastName;
	}
	public String getPassword() {
		return password;
	}
	public int getRole() {
		return role;
	}
	
	public void setUsrId(String UsrID) {
		this.userID = UsrID;
	}
	
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setUsrName(String usrName) {
		this.username = usrName;
	}	
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public void setPassword(String pass) {
		this.password = pass;
	}
	
	public void setRole(int role) {
		this.role = role;
	}
}

